<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sp" uri="http://www.springframework.org/tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>My JSP 'add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<link href="/css/reset.css" rel="stylesheet" type="text/css" />
<link href="/css/common.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/js/jquery_datapicker/themes/min/jquery.ui.all.min.css" />
<link rel="stylesheet" href="/js/jquery_datapicker/themes/min/jquery.ui.datepicker.min.css" />
<script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/js/jquery_datapicker/ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="/js/jquery_datapicker/ui/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="/js/jquery_datapicker/ui/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="/js/jquery_datapicker/ui/i18n/jquery.ui.datepicker-zh-CN.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/formcheck/formcheck-0.0.1.js"></script>
<style type="text/css">
#tr_upload td {
	display: none;
	visibility: hidden;
}
</style>
</head>

<body class="mainframe">
  <form id="examinForm" action="/admin/examin/edit.dhtml" method="post">
    <input type="hidden" id="examinId" name="examin.Id" value="<c:out value="${examin.id}" />" /> <input type="hidden"
      id="examinScoreSection" name="examin.scoreSection" value="<c:out value="${examin.scoreSection}" />" />
    <table class="admin_table">
      <caption>添加试卷</caption>
      <c:choose>
        <c:when test="${message.info != null }">
          <tr>
            <td colspan="2"><sp:message code="${message.info}" text="" /></td>
          </tr>
        </c:when>
        <c:otherwise>
          <tr>
            <td>标题</td>
            <td><input type="text" id="examinTitle" name="examin.title" value="<c:out value="${examin.title}" />" /><span
              id="examinTitleTip"></span></td>
          </tr>
          <tr>
            <td>说明</td>
            <td><textarea id="examinNote" name="examin.note" rows="4" cols="100"><c:out
                  value="${examin.note}" /></textarea></td>
          </tr>
          <tr>
            <td>不及格提示</td>
            <td><input type="text" id="examinFailNotice" name="examin.failNotice"
              value="<c:out value="${examin.failNotice}" />" /><span id="examinFailNotice"></span></td>
          </tr>
          <tr>
            <td>成功提示</td>
            <td><input type="text" id="examinSucNotice" name="examin.sucNotice"
              value="<c:out value="${examin.sucNotice}" />" /><span id="examinSucNotice"></span></td>
          </tr>
          <tr>
            <td>分数等级</td>
            <td>
              <div id="scoreContainer">
                <c:forEach items="${scoreInfoList}" var="ob">
                  <div class="item">
                    <input type="text" name="score" value="<c:out value="${ob.score }" />" />&nbsp;<input type="text"
                      name="info" value="<c:out value="${ob.info }" />" />&nbsp;
                    <button onclick="removeItem($(this))">删除</button>
                  </div>
                </c:forEach>
              </div> <a id="editItem" class="button02">编辑</a>&nbsp;<a id="addItem" class="button02">添加</a>&nbsp;<a id="addInfo"
              class="button02">确定</a>
              <div id="scoreContent" style="display: none; visibility: hidden;">
                <div class="item">
                  <input type="text" name="score" />&nbsp;<input type="text" name="info" />&nbsp;
                  <button onclick="removeItem($(this))">删除</button>
                </div>
              </div>
            </td>
          </tr>
          <tr>
            <td>答题时长</td>
            <td><input type="text" id="examinTimeLimit" name="examin.timeLimit"
              value="<c:out value="${examin.timeLimit}" />" /><span id="examinTimeLimit"></span></td>
          </tr>
          <tr>
            <td>状态</td>
            <td><select name="examin.stat">
                <option value="0" <c:out value="${ examin.stat == 0?'selected=\"selected\"':''}" escapeXml="false" />>编辑</option>
                <option value="1" <c:out value="${ examin.stat == 1?'selected=\"selected\"':''}" escapeXml="false" />>发布</option>
                <option value="2" <c:out value="${ examin.stat == 2?'selected=\"selected\"':''}" escapeXml="false" />>停用</option>
            </select></td>
          </tr>
          <tr>
            <td></td>
            <td><input type="submit" id="examinSubmit" value="添加" class="button01" /></td>
          </tr>
        </c:otherwise>
      </c:choose>
    </table>
  </form>
  <script type="text/javascript">
			// 表单验证
			var formCheck = $.formCheck();
			formCheck.regAllEmpty("examinTitle", {
				onShow : "输入目录名称",
				onFocus : "此项为必填",
				onError : "此项为必填",
				onCorrect : "目录名称输入正确"
			}, true);
			formCheck.formCheck("examinForm");
		</script>
  <script type="text/javascript" src="/js/admin/examin.js" ></script>
</body>
</html>